type t = ..

class type ['a] rtti =  object
  method to_dyn : 'a -> t
  method of_dyn : t -> 'a option
end

let create_reified (type a) () : a rtti =
  let module Tag = struct type t += V of a end in
  object
    method to_dyn x = Tag.V(x)
    method of_dyn = function
      | Tag.V(x) -> Some(x)
      | _ -> None
  end
